home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 3.iso
/
bin
/
create_netscape_preference_file
< prev
next >
Wrap
Text File
|
1996-11-11
|
2KB
|
52 lines
#!/bin/perl
$ENV{'PATH'} = "/usr/bsd:/bin/:/usr/bin:/usr/sbin:/usr/bin/X11";
sub read_it {
while (<PREF>) {
next if /^#/;
next if /^[ ]*$/;
next unless /^([^:]*):[ \t]*(.*)[ \t\n]*$/;
$values{$1} = $2;
}
close(PREF);
}
$pref = "netscape-preferences";
$user_home = $ENV{"HOME"};
$www_home = "$user_home/.www";
$www_home =~ s/\/\//\//;
exit(0) if -f "$www_home/.$pref";
if (open(PREF, "$user_home/.$pref")) {
&read_it;
$values{"CACHE_DIR"} = "$www_home/.netscape-cache"
unless $values{"CACHE_DIR"};
$values{"BOOKMARKS_FILE"} = "$www_home/.netscape-bookmarks.html"
unless $values{"BOOKMARKS_FILE"};
$values{"HISTORY_FILE"} = "$www_home/.netscape-history"
unless $values{"HISTORY_FILE"};
$values{"NEWSRC_DIR"} = "$www_home" unless $values{"NEWSRC_DIR"};
} elsif (open(PREF, "$www_home/$pref")) {
&read_it;
$values{"CACHE_DIR"} = "$www_home/.netscape-cache";
$values{"BOOKMARKS_FILE"} = "$www_home/.netscape-bookmarks.html";
$values{"HISTORY_FILE"} = "$www_home/.netscape-history";
$values{"NEWSRC_DIR"} = "$www_home";
} else {
print STDERR "Unable to read any preferences file\n";
print STDERR "Contact DTjanitor@sgi.com\n\n";
exit(1);
}
$values{"PERSONAL_MAILCAP"} = "$www_home/.mailcap";
$values{"PERSONAL_MIME_TYPES"} = "$www_home/.mime.types";
if (! open(PREF, ">$www_home/.$pref")) {
print STDERR "Unable to write preferences file ($www_home/.$pref)\n";
print STDERR "Contact DTjanitor@sgi.com\n\n";
exit(1);
}
while (($key,$value) = each %values) {
print PREF "$key:\t$value\n";
#print "$key:\t$value\n";
}
exit(0);